define(["jquery","template", 
	"scprit/nutrition/app/foodLibrary/foodLibrary.servers.js",
	"scprit/nutrition/template/foodLibrary/foodLibrary.tpl.js"],
	function($,template,$servers,tpl){
	var ui = {};

	var drawFoodLibirayList = function(data){
		return template("foodLibiray_List",data);
	}
	var drawAddFoodLibirayForm = function(data){
		return template("foodLibiray_addForm",data);
	}

	ui.foodLibirayListInit = function(options){
        $("#" + options.id).html(tpl.foodLibirayList());
        var html = drawFoodLibirayList($servers.handleFoodLibirayList(options.list));
        $("#" + options.id).html(html);
    };
    ui.addFoodLibirayFormInit = function(options){
    	var data = {}
        if(options.data) $.extend(data,options.data);
        options.dom.html(tpl.addFoodLibirayForm());
        var html = drawAddFoodLibirayForm(data);
        options.dom.html(html);
    };

	return ui;
});